package com.qf.main.pharmacy.controller;

import com.github.pagehelper.PageInfo;
import com.qf.common.base.result.ResponseResult;
import com.qf.main.pharmacy.common.qo.AuditQo;
import com.qf.main.pharmacy.common.vo.AuditVo;
import com.qf.main.pharmacy.mapper.AuditMapper;
import com.qf.main.pharmacy.service.AuditService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author chengqiang
 * @Create 2024-03-03-14:30
 * @Description:
 */
@RestController
@RequestMapping("/audit")
@CrossOrigin
@Api(tags = "审核管理")
public class AuditController {
    @Resource
    private AuditService auditService;

    @GetMapping("/list")
    public ResponseResult<PageInfo<AuditVo>> auditList(@RequestParam(value = "pageNum" ,required = false) Integer pageNum,
                                                        @RequestParam(value = "pageSize" ,required = false) Integer pageSize,
                                                        @RequestParam(value = "resource",required = false)Integer resource ){

        return  ResponseResult.success(auditService.auditList(pageNum,pageSize,resource));
    }


    @PostMapping("/save")
    public ResponseResult<Integer> saveAudit(@RequestBody AuditQo auditQo){
        return ResponseResult.success(auditService.saveAudit(auditQo));
    }
    @PostMapping("/edit")
    public ResponseResult<Integer> editAudit(@RequestBody AuditQo auditQo){
        return ResponseResult.success(auditService.saveAudit(auditQo));
    }
    @PostMapping("/erase")
    public ResponseResult<Integer> eraseAudit(@RequestBody AuditQo auditQo){
        return ResponseResult.success(auditService.saveAudit(auditQo));
    }
}
